Skip to main content
GET
/
api
/
productos
/
precio
Get Products by Price Range
curl --request GET \
  --url https://api.example.com/api/productos/precio
{
  "200": {},
  "400": {},
  "productos": [
    {
      "producto_id": 123,
      "sku": "<string>",
      "nombre": "<string>",
      "descripcion": "<string>",
      "precioCantidad": 123,
      "precioMoneda": "<string>",
      "dimensionesAlto": 123,
      "dimensionesAncho": 123,
      "dimensionesProfundo": 123,
      "es_destacado": true,
      "stock": 123,
      "imagen_url": "<string>",
      "categoria": {}
    }
  ]
}

Authentication

This endpoint is publicly accessible and does not require authentication.

Query Parameters

min
number
required
Minimum price (inclusive). Must be a positive decimal number.
max
number
required
Maximum price (inclusive). Must be greater than or equal to the minimum price.

Response

Returns an array of product objects that fall within the specified price range.
productos
array
Array of product objects matching the price criteria

Example Requests

curl -X GET "http://localhost:8080/api/productos/precio?min=0&max=500"
JavaScript
// Filter products between 200 and 800 EUR
const min = 200;
const max = 800;
const response = await fetch(
  `http://localhost:8080/api/productos/precio?min=${min}&max=${max}`
);
const products = await response.json();
console.log(`Found ${products.length} products in price range`);
Python
import requests

# Get products between 300 and 1000 EUR
params = {
    'min': 300,
    'max': 1000
}
response = requests.get(
    'http://localhost:8080/api/productos/precio',
    params=params
)
products = response.json()
print(f'Found {len(products)} products')

Example Response

[
  {
    "producto_id": 1,
    "sku": "SOFA-001",
    "nombre": "Sofá Klippan 2 plazas",
    "descripcion": "Sofá compacto y versátil con funda lavable",
    "precioCantidad": 299.00,
    "precioMoneda": "EUR",
    "dimensionesAlto": 66,
    "dimensionesAncho": 180,
    "dimensionesProfundo": 88,
    "es_destacado": true,
    "stock": 12,
    "imagen_url": "https://example.com/sofa-klippan.jpg",
    "categoria": {
      "categoria_id": 1,
      "nombre": "Salón",
      "slug": "salon"
    }
  },
  {
    "producto_id": 5,
    "sku": "MESA-003",
    "nombre": "Mesa de centro Lack",
    "descripcion": "Mesa de centro moderna con acabado blanco",
    "precioCantidad": 49.99,
    "precioMoneda": "EUR",
    "dimensionesAlto": 45,
    "dimensionesAncho": 90,
    "dimensionesProfundo": 55,
    "es_destacado": false,
    "stock": 28,
    "imagen_url": "https://example.com/mesa-lack.jpg",
    "categoria": {
      "categoria_id": 3,
      "nombre": "Mesas",
      "slug": "mesas"
    }
  }
]

Status Codes

200
OK
Products retrieved successfully. Returns an empty array if no products match the criteria.
400
Bad Request
Invalid parameters (e.g., min > max, negative values, missing parameters)

Use Cases

  • Price filtering: Allow customers to filter products by budget
  • Sales and promotions: Find products in specific price tiers
  • Comparison shopping: Show products within a customer’s price range
  • Inventory analysis: Identify products in different price segments
Combine this endpoint with other filters (category, search) on the frontend to create a comprehensive product filtering experience.
The price comparison uses the precioCantidad field. All products are assumed to be in the same currency for comparison purposes.